<?php

namespace Modules\Shop\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ArticleRequest extends FormRequest
{
    //验证规则
    public function rules()
    {
        return array (
        	'title'=>'required',
			'author'=>'required',
			'pid'=>'required',
			'content'=>'required',
			'thumb'=>'required',
			'click'=>'required',
			'iscommend'=>'required'
);
    }

    //错误信息处理
    public function messages()
    {
        return array (
			'title.required'=>'标题不能为空',
			'author.required'=>'作者不能为空',
			'pid.required'=>'必须选择分类',
			'content.required'=>'内容必须填写',
			'thumb.required'=>'请选择缩略图',
			'click.required'=>'请填写点击数'
);
    }

    //权限验证
    public function authorize()
    {
        return true;
    }
}
